<%@ page import="javax.servlet.http.Cookie" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%

response.setHeader("Cache-Control","no-cache"); // HTTP  1.1
response.setHeader("Pragma","no-cache"); // HTTP 1.0
response.setDateHeader ("Expires", -1); // Prevents caching at the proxy server
response.addHeader("Refresh", "600; URL=/logout.do");



    String invalidErrMsg = (String)request.getAttribute("invalidMsg");
	String contextPath=(String)(request.getContextPath());

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mark & Spencer's Online Examination System</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script>
function handleLoginBtn() {
	if( document.forms[0].j_username.value == "" ) {
		alert("User name blank");
		document.forms[0].j_username.focus();
		return false ;
	}

	if( document.forms[0].j_password.value == "" ) {
		alert("Password blank");
		document.forms[0].j_password.focus();
		return false ;
	} 
	document.forms[0].submit();
}

function showArrow(curobj)
{
	curobj.style.cursor = "hand";
}
</script>
</head>

<body onLoad="document.forms[0].j_username.focus();">
<table width="100%" height="535" border="0" valign="center" align="center" cellpadding="0" cellspacing="0" background="/images/loginPage.gif" style="background-repeat: font-size: 14px; font-family: Verdana, Geneva, sans-serif; font-size: 14; color: #CCC; font-weight: bold;">
  <tr>
    <td valign="top" align="center">
    <div style="height:70px;"></div>
    <div class="style2">
      <div align="right"><img src="/images/MSLOGO-Login.gif" /></div>
    </div>
    	<div style="height:55px;"></div>
		<form name=login action="j_security_check" method="POST"  >
        <table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
		  <%if(invalidErrMsg != null) {%>
						<tr>
							<td valign="top" align="left" colspan="2" class="login"><%=invalidErrMsg%></td>
						</tr>
						
					<%} else{%>	
                  <tr>
                    <td height="30" valign="top" class="login">&nbsp;</td>
                    <td align="left" valign="top">&nbsp;</td>
                  </tr>
                  <% }%>
  <tr>
    <td><span class="loginText">Username</span></td>
    <td><input name="j_username" type="text" maxlength="20" onKeyPress="if(event.keyCode==13) return handleLoginBtn();"  tabindex="1"></td>
  </tr>
  <tr>
     <td height="10"></td>
  </tr>
  <tr>
    <td><span class="loginText">Password</span></td>
    <td><input name="j_password" type="password" maxlength="20" onKeyPress="if(event.keyCode==13) return handleLoginBtn();" tabindex="2"></td>
  </tr>
           
       <tr>
     <td height="10"></td>
    </tr>
      <tr>
        <td valign="middle" align="right">
		 </td>
		 <td>
           <input type="button" name="button" id="button" class="imageButton" value="Submit" onmouseover="showArrow(this);" onclick="return handleLoginBtn();" onKeyPress="if(event.keyCode==13) return handleLoginBtn();"/>
		   </td>		
      </tr>
</table>
</form>

        </td>
        </tr>
</table>
</body>
</html>